import request from '@renderer/server'

// 查看好友信息
export const getFriendInfoApi = (id: number) => {
  return request.get({
    url: `/friend/friendUser?id=${id}`
  })
}

// 修改好友备注
export const updateFriendRemarkApi = (nickname: string, id: number) => {
  return request.post({
    url: `/friend/sdit_n/${id}`,
    data: {
      nickname
    }
  })
}

// 添加好友
export const addFriendApi = (info: any) => {
  return request.post({
    url: `/friend/add`,
    data: {
      friend_id: info.id,
      ...info
    }
  })
}

// 删除好友
export const deleteFriendApi = (id: number) => {
  return request.post({
    url: `/friend/delete/${id}`
  })
}

// 获得好友申请列表
export const getFriendApplyListApi = () => {
  return request.get({
    url: `/friend/list`
  })
}

// 处理好友申请
export const handleFriendApplyApi = (data) => {
  return request.post({
    url: `/friend/handle`,
    data
  })
}

// 修改圈子查看权限
export const updateFriendCircleAuthApi = (id: number, info: any) => {
  return request.post({
    url: `/friend/setLook/${id}`,
    data: info
  })
}

// 获得好友信息 user表
export const getFriendInfoByIdApi = (id: number) => {
  return request.get({
    url: `/friend/friendUser?id=${id}`
  })
}

// 获得好友信息 friend表
export const getFriendInfoByFriendIdApi = (ids: {
  id: number
  friend_id: number
}) => {
  return request.get({
    url: `/friend/friendInfo`,
    params: ids
  })
}

// 
